//
//  BwDDHrJLCFListPayCompleteViewControllerHlxtCn.m
//  qcb_ios
//
//  Created by Ji on 2018/9/4.
//  Copyright © 2018年 ski. All rights reserved.
//

#import "BwDDHrJLCFListPayCompleteViewControllerHlxtCn.h"

@interface BwDDHrJLCFListPayCompleteViewControllerHlxtCn ()

@end

@implementation BwDDHrJLCFListPayCompleteViewControllerHlxtCn

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self addNavigationBar];
    self.navigationBar.title = self.jsifqPtitleStrphUVlL;
    self.view.backgroundColor = QTZ_Gray237;
    
    [self configView];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self stopPopGestureRecognizer];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [self openPopGestureRecognizer];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)configView
{
    
    UIImageView *vzcsvgstatusImgBoOiic = [[UIImageView alloc] initWithImage:[UIImage imageNamed:self.success ? @"icon_list_pay_success" : @"icon_list_pay_failure"]];
    vzcsvgstatusImgBoOiic.centerX = FULL_WIDTH / 2;
    vzcsvgstatusImgBoOiic.top = NAVBAR_HEIGHT + 73;
    [self.view addSubview:vzcsvgstatusImgBoOiic];
    
    UILabel *LufDjKnameLabelRjatWG = [UILabel labelWithText:self.success ? self.IUBZVipayCompleteDataOJvPHe.borrowName : self.borrowName textColor:self.success ? RGB(7, 212, 2) : QTZ_Gray51 font:FONT(25)];
    LufDjKnameLabelRjatWG.centerX = vzcsvgstatusImgBoOiic.centerX;
    LufDjKnameLabelRjatWG.top = vzcsvgstatusImgBoOiic.bottom + 16;
    [self.view addSubview:LufDjKnameLabelRjatWG];
    
    UILabel *giAZzBstatusLabelmYmPuF = [UILabel labelWithText:self.success ? [NSString stringWithFormat:@"投资%@元成功", self.IUBZVipayCompleteDataOJvPHe.amt] : @"投资失败" textColor:QTZ_Gray102 font:FONT(12)];
    giAZzBstatusLabelmYmPuF.centerX = vzcsvgstatusImgBoOiic.centerX;
    giAZzBstatusLabelmYmPuF.top = LufDjKnameLabelRjatWG.bottom + 15;
    [self.view addSubview:giAZzBstatusLabelmYmPuF];
    
    if (self.success) {
        UILabel *wvuzPolimitLabellnCQvV = [UILabel labelWithText:[NSString stringWithFormat:@"投资期限%@天", self.IUBZVipayCompleteDataOJvPHe.timeLimitDay] textColor:QTZ_Gray102 font:FONT(12)];
        wvuzPolimitLabellnCQvV.centerX = vzcsvgstatusImgBoOiic.centerX;
        wvuzPolimitLabellnCQvV.top = giAZzBstatusLabelmYmPuF.bottom + 12;
        [self.view addSubview:wvuzPolimitLabellnCQvV];
        
        UILabel *incomeLabel = [UILabel labelWithText:[NSString stringWithFormat:@"预计收益%@元", self.IUBZVipayCompleteDataOJvPHe.income] textColor:QTZ_RED font:FONT(12)];
        incomeLabel.centerX = vzcsvgstatusImgBoOiic.centerX;
        incomeLabel.top = wvuzPolimitLabellnCQvV.bottom + 12;
        [self.view addSubview:incomeLabel];
    }
    
    UIButton *rebuyBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 160, 40)];
    rebuyBtn.centerX = vzcsvgstatusImgBoOiic.centerX;
    rebuyBtn.top = LufDjKnameLabelRjatWG.bottom + 115;
    rebuyBtn.layer.cornerRadius = 5;
    [rebuyBtn setBackgroundColor:QTZ_RED];
    rebuyBtn.titleLabel.font = FONT(15);
    [rebuyBtn setTitle:@"再次购买" forState:0];
    [rebuyBtn addTarget:self action:@selector(handleRebuy) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:rebuyBtn];
    
    UIButton *backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 160, 40)];
    backBtn.centerX = vzcsvgstatusImgBoOiic.centerX;
    backBtn.top = rebuyBtn.bottom + 15;
    backBtn.layer.cornerRadius = 5;
    backBtn.layer.borderColor = QTZ_RED.CGColor;
    backBtn.layer.borderWidth = 1;
    [backBtn setTitleColor:QTZ_RED forState:0];
    backBtn.titleLabel.font = FONT(15);
    [backBtn setTitle:@"返回首页" forState:0];
    [backBtn addTarget:self action:@selector(handleBack) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:backBtn];
    
    
}

- (void)handleRebuy
{
    [[JinLiCaiFuApplicationEntrace shareEntrance].currentNavController popToRootViewControllerAnimated:NO onCompletion:^{
        [[JinLiCaiFuApplicationEntrace shareEntrance].tabBarViewController setSelectedIndex:1];
    }];
}

- (void)handleBack
{
    [[JinLiCaiFuApplicationEntrace shareEntrance].currentNavController popToRootViewControllerAnimated:NO onCompletion:^{
        [[JinLiCaiFuApplicationEntrace shareEntrance].tabBarViewController setSelectedIndex:0];
    }];
}

@end
